package com.sxx.beautifulcity.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.TextView;

import com.sxx.beautifulcity.R;
import com.sxx.beautifulcity.popmenu.CommonPopMenu;

/**
 * Created by dllo on 15/10/26.
 */
public class NearFragmentDetailActivity extends AppCompatActivity implements View.OnClickListener {
    private WebView nearDetailWb;
    private long user_distance_poi;
    private TextView titleTv , moreTv;
    private ImageView backIv;
    private String path;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_near_detail);
        initView();
    }


    private void initView() {
        moreTv = (TextView) findViewById(R.id.moreTv);
        moreTv.setOnClickListener(this);

        nearDetailWb = (WebView) findViewById(R.id.nearDetailWb);
        titleTv = (TextView) findViewById(R.id.titleTv);
        titleTv.setText("附近详情");
        backIv = (ImageView) findViewById(R.id.backIV);
        backIv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(NearFragmentDetailActivity.this , MainActivity.class);
                startActivity(intent);
                finish();
                overridePendingTransition(R.anim.left_out, R.anim.right_into);
            }
        });

        Intent intent = getIntent();
        user_distance_poi = intent.getLongExtra("user_distance_poi", 5235695);

        path = "http://t10.nuomi.com/webapp/na/merchant?merchantId="+user_distance_poi+"" +
                "&s=c335a5f2fd730a3402eeb9c40826715c&cityId=1300010000&" +
                "cuid=0331BA7C1CAC7E212101A8DCB921ACDF%7C000000000000000";
        Log.i("sunxiiiii", path);
        nearDetailWb.loadUrl(path);
    }

    @Override
    public void onClick(View v) {
        PopupMenu menu = CommonPopMenu.setHelpShopPopMenu(v , path);
    }
}
